<template>
    <div class="common examAdd">
        <innerCommon :location="location">
            <template slot="right">
                <a-button type="primary" @click="returnBack()">返回</a-button>
            </template>
            <template slot="table">
                <div  class="prism-player" id="J_prismPlayer"  style="max-width:100%;margin:0 auto;height:500px"></div>
            </template>
        </innerCommon>
    </div>
</template>
<script>
import "../../lib/aliyun-upload-sdk-1.5.0.min.js"
import "../../lib/aliyun-oss-sdk-5.3.1.min.js"
import {getPlayAuthApi} from "@/request/api"
import innerCommon from "@/components/common/innerCommon"
export default {
    name:'previewVideo',
    components:{innerCommon},
    created(){
        this.videoId=this.$route.query.id
        this.location=[
            {
                name:"教学课堂管理",
                path:'/course'
            },{
                name:'视频预览',
                path:''
            }
        ]
        this.init()
    },
    data(){
        return{
            location:[],
            videoId:null
        }
    },
    methods:{
        returnBack(){
            this.$router.go(-1)
        },
        init(){
            this.getToken(getPlayAuthApi,{'videoId':this.videoId},res=>{
                let playData=res.data
                var player = new Aliplayer({
                    id: 'J_prismPlayer',
                    width: '100%',
                    autoplay: false,
                    vid : this.videoId,
                    playauth:playData.PlayAuth,
                    cover:playData.VideoMeta.CoverURL,
                    encryptType:1, //当播放私有加密流时需要设置。
                },()=>{
                    
                })
            })
        }
    }
}
</script>